package com.tianxiao.faas.common.util;

import com.google.common.collect.Lists;

import java.util.List;

public class ImageUtils {
    private static List<String> images = Lists.newArrayList(".jpg", ".jpeg", ".webp", ".png");

    private static List<String> movs = Lists.newArrayList("mov","m4v","3gp","mp4","avi","dat", "mkv","flv");

    public static Boolean isImage(String path) {
        if (path == null) {
            return false;
        }
        for (String image : images) {
            if (path.endsWith(image)) {
                return true;
            }
        }
        return false;
    }

    public static Boolean isMov(String path) {
        if (path == null) {
            return false;
        }
        for (String mov : movs) {
            if (path.endsWith(mov)) {
                return true;
            }
        }
        return false;
    }
}
